<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
<!--Converted with LaTeX2HTML 96.1 (Feb 5, 1996) by Nikos Drakos (nikos@cbl.leeds.ac.uk), CBLU, University of Leeds -->


<title>Combinations</title>
<meta name="description" content="Combinations">
<meta name="keywords" content="htmlatex">
<meta name="resource-type" content="document">
<meta name="distribution" content="global">
<link rel="STYLESHEET" href="acm-00369_archivos/htmlatex.css">
</head><body bgcolor="#ffffff" lang="EN">
 <h1><br clear="all"><center><table bgcolor="#0060f0"><tbody><tr><td><b><font color="#c0ffff" size="5">&nbsp;<a name="SECTION0001000000000000000000">Combinations</a></font>&nbsp;</b></td></tr></tbody></table></center></h1>
<p>
Computing the exact number of ways that <i>N</i> things can be taken <i>M</i> at a
time can be a great challenge when <i>N</i> and/or <i>M</i> become very large.  Challenges
are the stuff of contests.  Therefore, you are to make just such a
computation given the following:
</p><p>
</p><p>
</p><p>
<b>GIVEN:</b>
</p><p> <img alt="displaymath41" src="acm-00369_archivos/369img1.gif" align="bottom" height="16" width="481"> </p><p>
</p><p>
Compute the <b>EXACT</b> value of:
</p><p>
</p><p> <img alt="displaymath43" src="acm-00369_archivos/369img2.gif" align="bottom" height="41" width="329"> </p><p>
</p><p>
You may assume that the final value of <i>C</i> will fit in a 32-bit Pascal LongInt
or a C long.
</p><p>
</p><p>
For the record, the exact value of 100! is:
</p><p>
</p><pre>     93,326,215,443,944,152,681,699,238,856,266,700,490,715,968,264,381,621,
        468,592,963,895,217,599,993,229,915,608,941,463,976,156,518,286,253,
        697,920,827,223,758,251,185,210,916,864,000,000,000,000,000,000,000,000</pre>
<p>
</p><h2><font color="#0070e8"><a name="SECTION0001001000000000000000">Input and Output</a></font></h2>
<p>
     The input to this program will be one or more lines each containing zero
or more leading spaces, a value for <i>N</i>, one or more spaces, and a value for <i>M</i>. The last line of the input file will contain a dummy <i>N</i>, <i>M</i> pair with both values equal to zero.  Your program should terminate when this line is read.
</p><p>
</p><p>
The output from this program should be in the form:
</p><p>
</p><p>
</p><p>
<i>N</i> <tt>things taken</tt> <i>M</i> <tt>at a time is</tt> <i>C</i> <tt>exactly.</tt>
</p><p>
</p><h2><font color="#0070e8"><a name="SECTION0001002000000000000000">Sample Input</a></font></h2>
<p>
</p><pre>     100  6
      20  5
      18  6
       0  0</pre>
<p>
</p><h2><font color="#0070e8"><a name="SECTION0001003000000000000000">Sample Output</a></font></h2>
<p>
</p><pre>100 things taken 6 at a time is 1192052400 exactly.
20 things taken 5 at a time is 15504 exactly.
18 things taken 6 at a time is 18564 exactly.
<p>
</p></pre></body></html>